package com.peng.pay_thrift.main;

import org.apache.thrift.TProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TTransportException;

import com.peng.pay_thrift.meta.PayService;
import com.peng.pay_thrift.service.PayServer;

public class PayServerMain {
	public static void main(String[] args) {
		try {
			System.out.println("【User】服务端开启....");
			TProcessor tprocessor = new PayService.Processor<PayService.Iface>(new PayServer());
			TServerSocket serverTransport = new TServerSocket(6666);
			TServer.Args tArgs = new TServer.Args(serverTransport);
			tArgs.processor(tprocessor);
			tArgs.protocolFactory(new TBinaryProtocol.Factory());
			TServer server = new TSimpleServer(tArgs);
			server.serve();
		} catch (TTransportException e) {
			e.printStackTrace();
		}
	}
}
